//导入pinia
import { createPinia } from "pinia";
//引入pinia持久化存储插件
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import { createApp } from "vue";
import App from "./App.vue";
import "@/styles/common.scss";
import router from "./router";

//引入全局组件插件
import { componentPlugin } from "@/components";

// 引入懒加载指令插件
import { lazyPlugin } from "@/directives/index";

// 以app为参数生成一个应用实例对象
const app = createApp(App);

//创建pinia实例
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);

app.use(ElementPlus);

//把pinia实例加入到app应用中
app.use(pinia);

//使用路由器
app.use(router);

// 全局指令注册
app.use(lazyPlugin);

//注册全局组件插件
app.use(componentPlugin);

//挂载到id为app的节点上
app.mount("#app");
